<?php
/** 
 * 
 * Lop xu ly login
 * 
 * @author          TapNM <tapnmpeacesoft.net>
 * @package         commerce
 * @subpackage      user/include 
 * @since           Crawl 
 */
class UserLogin {
	/**
	 * user login
	 * @param: $userName username
	 * @param: $email email
	 * @param: $passWord password
	 * @return: SUCCESS neu thanh cong, error code neu co loi
	 */
	static function login($username = '', $password, $cookie="") {
        $username = stripslashes($username);
        $password = stripslashes($password);
        $password = md5($password);
        $user = db()->selectOne('users','*'," `user_name` = '".$username."' AND `password` = '".$password."'");
        if($user)
        {
            $arrInfoUser['user_name'] = $user['user_name'];
            $arrInfoUser['full_name'] = $user['full_name'];
            $arrInfoUser['password'] = $user['password'];
            UserCurrent::logIn($arrInfoUser);
            $code = "SUCCESS";
        }
        else
            $code = "FAIL";
        return $code;   
    
	}
	
}
?>